%%{init: {'themeVariables': { 'fontSize': '12px'}}}%%
graph TD
    classDef path fill:#eee,stroke:#000,color:#000
    classDef plan fill:#fff,stroke-width:1px,color:#000
    classDef itemplan fill:#fff,stroke-width:2px,color:#000
    classDef unbatchedplan fill:#dff,stroke-width:1px,color:#000
    classDef sideeffectplan fill:#fcc,stroke-width:2px,color:#000
    classDef bucket fill:#f6f6f6,color:#000,stroke-width:2px,text-align:left

    subgraph "Buckets for mutations/v4/partitions.unqualified"
    Bucket0("Bucket 0 (root)"):::bucket
    Bucket1("Bucket 1 (mutationField)<br />Deps: 16, 17, 2<br /><br />1: PgInsertSingle[13]<br />2: <br />ᐳ: Object[18]"):::bucket
    Bucket2("Bucket 2 (mutationField)<br />Deps: 56, 57, 26, 2<br /><br />1: Access[23]<br />2: Access[24]<br />3: Object[25]<br />4: PgUpdateSingle[22]<br />5: <br />ᐳ: Object[27]"):::bucket
    Bucket3("Bucket 3 (nullableBoundary)<br />Deps: 2, 13, 18<br /><br />ROOT Object{1}ᐸ{result}ᐳ[18]"):::bucket
    Bucket4("Bucket 4 (nullableBoundary)<br />Deps: 2, 22, 27<br /><br />ROOT Object{2}ᐸ{result}ᐳ[27]"):::bucket
    Bucket5("Bucket 5 (nullableBoundary)<br />Deps: 13, 40<br /><br />ROOT PgInsertSingle{1}ᐸmeasurements()ᐳ[13]<br />1: <br />ᐳ: 29, 28, 32, 34, 36<br />2: PgSelect[37]<br />3: PgSelectRows[42]<br />ᐳ: First[41], PgSelectSingle[43]"):::bucket
    Bucket6("Bucket 6 (nullableBoundary)<br />Deps: 22, 48<br /><br />ROOT PgUpdateSingle{2}ᐸmeasurements(timestamp,key;)ᐳ[22]<br />1: <br />ᐳ: 31, 30, 33, 35, 44<br />2: PgSelect[45]<br />3: PgSelectRows[50]<br />ᐳ: First[49], PgSelectSingle[51]"):::bucket
    Bucket7("Bucket 7 (nullableBoundary)<br />Deps: 43, 13<br /><br />ROOT PgSelectSingle{5}ᐸusersᐳ[43]"):::bucket
    Bucket8("Bucket 8 (nullableBoundary)<br />Deps: 51, 22<br /><br />ROOT PgSelectSingle{6}ᐸusersᐳ[51]"):::bucket
    end
    Bucket0 --> Bucket1 & Bucket2
    Bucket1 --> Bucket3
    Bucket2 --> Bucket4
    Bucket3 --> Bucket5
    Bucket4 --> Bucket6
    Bucket5 --> Bucket7
    Bucket6 --> Bucket8

    %% plan dependencies
    __InputObject8{{"__InputObject[8∈0] ➊<br />More deps:<br />- Constantᐸ'2023-05-24T07:43:00Z'ᐳ[56]<br />- Constantᐸ'temp'ᐳ[57]<br />- Constantᐸ12.7ᐳ[58]<br />- Constantᐸ4ᐳ[59]"}}:::plan
    __InputObject19{{"__InputObject[19∈0] ➊<br />More deps:<br />- Constantᐸundefinedᐳ[7]<br />- Constantᐸ'2023-05-24T07:43:00Z'ᐳ[56]<br />- Constantᐸ'temp'ᐳ[57]"}}:::plan
    __InputObject20{{"__InputObject[20∈0] ➊<br />More deps:<br />- Constantᐸundefinedᐳ[7]<br />- Constantᐸ13ᐳ[60]"}}:::plan
    __InputObject20 --> __InputObject19
    __InputObject6{{"__InputObject[6∈0] ➊<br />More deps:<br />- Constantᐸundefinedᐳ[7]"}}:::plan
    __InputObject8 --> __InputObject6
    Object16{{"Object[16∈0] ➊<br />ᐸ{pgSettings,withPgClient}ᐳ"}}:::plan
    Access14{{"Access[14∈0] ➊<br />ᐸ2.pgSettingsᐳ<br />More deps:<br />- __Value[2]"}}:::plan
    Access15{{"Access[15∈0] ➊<br />ᐸ2.withPgClientᐳ<br />More deps:<br />- __Value[2]"}}:::plan
    Access14 & Access15 --> Object16
    ApplyInput17{{"ApplyInput[17∈0] ➊"}}:::plan
    __InputObject6 --> ApplyInput17
    ApplyInput26{{"ApplyInput[26∈0] ➊"}}:::plan
    __InputObject19 --> ApplyInput26
    __Value2["__Value[2∈0] ➊<br />ᐸcontextᐳ<br />Dependents: 8"]:::plan
    PgInsertSingle13[["PgInsertSingle[13∈1] ➊<br />ᐸmeasurements()ᐳ"]]:::sideeffectplan
    Object16 & ApplyInput17 --> PgInsertSingle13
    Object18{{"Object[18∈1] ➊<br />ᐸ{result}ᐳ"}}:::plan
    PgInsertSingle13 --> Object18
    PgUpdateSingle22[["PgUpdateSingle[22∈2] ➊<br />ᐸmeasurements(timestamp,key;)ᐳ<br />More deps:<br />- Constantᐸ'2023-05-24T07:43:00Z'ᐳ[56]<br />- Constantᐸ'temp'ᐳ[57]"]]:::sideeffectplan
    Object25{{"Object[25∈2] ➊<br />ᐸ{pgSettings,withPgClient}ᐳ"}}:::plan
    Object25 & ApplyInput26 --> PgUpdateSingle22
    Access23{{"Access[23∈2] ➊<br />ᐸ2.pgSettingsᐳ<br />More deps:<br />- __Value[2]"}}:::plan
    Access24{{"Access[24∈2] ➊<br />ᐸ2.withPgClientᐳ<br />More deps:<br />- __Value[2]"}}:::plan
    Access23 & Access24 --> Object25
    Object27{{"Object[27∈2] ➊<br />ᐸ{result}ᐳ"}}:::plan
    PgUpdateSingle22 --> Object27
    Object40{{"Object[40∈3] ➊<br />ᐸ{pgSettings,withPgClient}ᐳ"}}:::plan
    Access38{{"Access[38∈3] ➊<br />ᐸ2.pgSettingsᐳ<br />More deps:<br />- __Value[2]"}}:::plan
    Access39{{"Access[39∈3] ➊<br />ᐸ2.withPgClientᐳ<br />More deps:<br />- __Value[2]"}}:::plan
    Access38 & Access39 --> Object40
    Object48{{"Object[48∈4] ➊<br />ᐸ{pgSettings,withPgClient}ᐳ"}}:::plan
    Access46{{"Access[46∈4] ➊<br />ᐸ2.pgSettingsᐳ<br />More deps:<br />- __Value[2]"}}:::plan
    Access47{{"Access[47∈4] ➊<br />ᐸ2.withPgClientᐳ<br />More deps:<br />- __Value[2]"}}:::plan
    Access46 & Access47 --> Object48
    PgSelect37[["PgSelect[37∈5] ➊<br />ᐸusersᐳ"]]:::plan
    PgClassExpression36{{"PgClassExpression[36∈5] ➊<br />ᐸ__measurem....”user_id”ᐳ"}}:::plan
    Object40 & PgClassExpression36 --> PgSelect37
    PgClassExpression28{{"PgClassExpression[28∈5] ➊<br />ᐸ__measurem...timestamp”ᐳ"}}:::plan
    Access29{{"Access[29∈5] ➊<br />ᐸ13.tᐳ"}}:::plan
    Access29 --> PgClassExpression28
    PgInsertSingle13 --> Access29
    PgClassExpression32{{"PgClassExpression[32∈5] ➊<br />ᐸ__measurements__.”key”ᐳ"}}:::plan
    PgClassExpression28 o--o PgClassExpression32
    PgClassExpression34{{"PgClassExpression[34∈5] ➊<br />ᐸ__measurem...__.”value”ᐳ"}}:::plan
    PgClassExpression32 o--o PgClassExpression34
    Access29 --> PgClassExpression36
    First41{{"First[41∈5] ➊"}}:::plan
    PgSelectRows42[["PgSelectRows[42∈5] ➊"]]:::plan
    PgSelectRows42 --> First41
    PgSelect37 --> PgSelectRows42
    PgSelectSingle43{{"PgSelectSingle[43∈5] ➊<br />ᐸusersᐳ"}}:::plan
    First41 --> PgSelectSingle43
    PgSelect45[["PgSelect[45∈6] ➊<br />ᐸusersᐳ"]]:::plan
    PgClassExpression44{{"PgClassExpression[44∈6] ➊<br />ᐸ__measurem....”user_id”ᐳ"}}:::plan
    Object48 & PgClassExpression44 --> PgSelect45
    PgClassExpression30{{"PgClassExpression[30∈6] ➊<br />ᐸ__measurem...timestamp”ᐳ"}}:::plan
    Access31{{"Access[31∈6] ➊<br />ᐸ22.tᐳ"}}:::plan
    Access31 --> PgClassExpression30
    PgUpdateSingle22 --> Access31
    PgClassExpression33{{"PgClassExpression[33∈6] ➊<br />ᐸ__measurements__.”key”ᐳ"}}:::plan
    PgClassExpression30 o--o PgClassExpression33
    PgClassExpression35{{"PgClassExpression[35∈6] ➊<br />ᐸ__measurem...__.”value”ᐳ"}}:::plan
    PgClassExpression33 o--o PgClassExpression35
    Access31 --> PgClassExpression44
    First49{{"First[49∈6] ➊"}}:::plan
    PgSelectRows50[["PgSelectRows[50∈6] ➊"]]:::plan
    PgSelectRows50 --> First49
    PgSelect45 --> PgSelectRows50
    PgSelectSingle51{{"PgSelectSingle[51∈6] ➊<br />ᐸusersᐳ"}}:::plan
    First49 --> PgSelectSingle51
    PgClassExpression52{{"PgClassExpression[52∈7] ➊<br />ᐸ__users__.”id”ᐳ"}}:::plan
    PgSelectSingle43 --> PgClassExpression52
    PgClassExpression54{{"PgClassExpression[54∈7] ➊<br />ᐸ__users__.”name”ᐳ"}}:::plan
    PgClassExpression52 o--o PgClassExpression54
    PgClassExpression53{{"PgClassExpression[53∈8] ➊<br />ᐸ__users__.”id”ᐳ"}}:::plan
    PgSelectSingle51 --> PgClassExpression53
    PgClassExpression55{{"PgClassExpression[55∈8] ➊<br />ᐸ__users__.”name”ᐳ"}}:::plan
    PgClassExpression53 o--o PgClassExpression55

    %% define steps
    classDef bucket0 stroke:#696969
    class Bucket0,__Value2,__InputObject6,__InputObject8,Access14,Access15,Object16,ApplyInput17,__InputObject19,__InputObject20,ApplyInput26 bucket0
    classDef bucket1 stroke:#00bfff
    class Bucket1,PgInsertSingle13,Object18 bucket1
    classDef bucket2 stroke:#7f007f
    class Bucket2,PgUpdateSingle22,Access23,Access24,Object25,Object27 bucket2
    classDef bucket3 stroke:#ffa500
    class Bucket3,Access38,Access39,Object40 bucket3
    classDef bucket4 stroke:#0000ff
    class Bucket4,Access46,Access47,Object48 bucket4
    classDef bucket5 stroke:#7fff00
    class Bucket5,PgClassExpression28,Access29,PgClassExpression32,PgClassExpression34,PgClassExpression36,PgSelect37,First41,PgSelectRows42,PgSelectSingle43 bucket5
    classDef bucket6 stroke:#ff1493
    class Bucket6,PgClassExpression30,Access31,PgClassExpression33,PgClassExpression35,PgClassExpression44,PgSelect45,First49,PgSelectRows50,PgSelectSingle51 bucket6
    classDef bucket7 stroke:#808000
    class Bucket7,PgClassExpression52,PgClassExpression54 bucket7
    classDef bucket8 stroke:#dda0dd
    class Bucket8,PgClassExpression53,PgClassExpression55 bucket8

    %% implicit side effects
    PgInsertSingle13 -.-o Access38
    PgInsertSingle13 -.-o Access39
    PgUpdateSingle22 -.-o Access46
    PgUpdateSingle22 -.-o Access47

